#include <sstream>
#include <iostream>
#include "TcpServer.hpp" // 网络通信开断连接 //会话层
#include <memory>
#include "Http.hpp"
#include <string>
#include <iostream>
using namespace std;
void Usag(string buffer)
{
    cout<<buffer<< "+ port";
}

int main(int argc ,char* argv[])
{
    if (argc != 2)
    {
        string buffer = argv[0];
        Usag(argv[0]);
        exit(0);
    }
    EnableConsoleLogStrategy();
    uint16_t port =stoi(argv[1]);
    std::unique_ptr<Http> http = std::make_unique<Http>();
    //Http http;
    unique_ptr<TcpServer> server =make_unique<TcpServer>(port,
    [&http](std::string& buffer)->std::string
    {
        return http->HttpDserialize(buffer);
    });
    server->Run();
    return 0;
}